package com.ygqh.baby.po;

import com.ygqh.baby.ao.*;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public class YgOrder implements Cloneable {
    private Long id;

    private Long orderId;

    private String wdtOrderCode;

    private Long userId;

    private Long supplierId;

    private Long parentId;

    private BigDecimal totalPrice;

    private BigDecimal vipDisPrice;

    private BigDecimal productPrice;

    private BigDecimal youhuijuanPrice;

    private BigDecimal manjianPrice;

    private BigDecimal newCustomDisPrice;

    private BigDecimal groupDisPrice;

    private BigDecimal packDisPrice;

    private BigDecimal bmdisPrice;

    private BigDecimal paidPrice;

    private BigDecimal expressPrice;

    private BigDecimal accountPrice;

    private OrderStatus orderStatus;

    private PayType payType;

    private Date paidTime;

    private String cancelReason;

    private Date cancelTime;

    private Date sendTime;

    private String expressCompany;

    private String logisticsCode;

    private String expressCode;

    private Date confirmReceiveTime;

    private String receiver;

    private String provinceName;

    private String cityName;

    private String areaName;

    private String address;

    private String telPhone;

    private String postCode;

    private String sourceCode;

    private Long couponDetailId;

    private String formId;

    private AppType appType;

    private String userRemark;

    private Date createTime;

    private DataStatus status;

    private CommentStatus commentStatus;

    private String platformNo;

    private String platformName;

    private String prepayId;
    // ======================================
    private String userName;
    private String nickName;

    private String productNames;

    private Integer itemCount;

    private Long orderPayCode;

    private Long returnOrderId;

    private String returnCode;

    private List<YgLogistics> logisticsList;

    /**
     * 是否存在退换货
     */
    private Boolean hasReturnOrChange;
    private OrderType orderType;

    private Long releationId;

    private Boolean newPaidUser;

    public YgOrder() {
        super();
    }

    /**
     * 取消订单
     *
     * @param orderId
     * @param cancelReason
     */
    public YgOrder(Long orderId, String cancelReason) {
        super();
        this.orderId = orderId;
        this.orderStatus = OrderStatus.TradeClosed;
        this.cancelReason = cancelReason;
        this.cancelTime = new Date();
    }

    public YgOrder(Long orderId, String receiver, String provinceName, String cityName, String areaName, String address, String telPhone) {
        super();
        this.orderId = orderId;
        this.receiver = receiver;
        this.provinceName = provinceName;
        this.cityName = cityName;
        this.areaName = areaName;
        this.address = address;
        this.telPhone = telPhone;
    }

    /**
     * @param orderId      非空
     * @param wdtOrderCode 可空
     * @param orderStatus  非空
     * @param sendTime     非空
     * @Title: 发货状态
     * @Description: TODO
     */
    public YgOrder(Long orderId, String wdtOrderCode, OrderStatus orderStatus, Date sendTime) {
        super();
        this.orderId = orderId;
        this.wdtOrderCode = wdtOrderCode;
        this.orderStatus = orderStatus;
        this.sendTime = sendTime;
    }

    public BigDecimal getOrderSharePrice(BigDecimal itemPrice) {
        if (itemPrice == null) {
            return null;
        }
        BigDecimal totalShare = productPrice.add(expressPrice).subtract(totalPrice);
        BigDecimal itemSharePrice = totalShare.divide(productPrice, BigDecimal.ROUND_HALF_UP).multiply(itemPrice).setScale(2, BigDecimal.ROUND_HALF_UP);
        return itemPrice.subtract(itemSharePrice);
    }

    public BigDecimal getVipDisPrice() {
        return vipDisPrice;
    }

    public void setVipDisPrice(BigDecimal vipDisPrice) {
        this.vipDisPrice = vipDisPrice;
    }

    public String getPlatformName() {
        return platformName;
    }

    public void setPlatformName(String platformName) {
        this.platformName = platformName;
    }

    public String getPlatformNo() {
        return platformNo;
    }

    public void setPlatformNo(String platformNo) {
        this.platformNo = platformNo;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public BigDecimal getBmdisPrice() {
        return bmdisPrice;
    }

    public void setBmdisPrice(BigDecimal bmdisPrice) {
        this.bmdisPrice = bmdisPrice;
    }

    public BigDecimal getGroupDisPrice() {
        return groupDisPrice;
    }

    public void setGroupDisPrice(BigDecimal groupDisPrice) {
        this.groupDisPrice = groupDisPrice;
    }

    public Boolean getHasReturnOrChange() {
        return hasReturnOrChange;
    }

    public void setHasReturnOrChange(Boolean hasReturnOrChange) {
        this.hasReturnOrChange = hasReturnOrChange;
    }

    public String getReturnCode() {
        return returnCode;
    }

    public void setReturnCode(String returnCode) {
        this.returnCode = returnCode;
    }

    public BigDecimal getAccountPrice() {
        return accountPrice;
    }

    public void setAccountPrice(BigDecimal accountPrice) {
        this.accountPrice = accountPrice;
    }

    public List<YgLogistics> getLogisticsList() {
        return logisticsList;
    }

    public void setLogisticsList(List<YgLogistics> logisticsList) {
        this.logisticsList = logisticsList;
    }

    public Long getOrderPayCode() {
        return orderPayCode;
    }

    public void setOrderPayCode(Long orderPayCode) {
        this.orderPayCode = orderPayCode;
    }

    public Long getReturnOrderId() {
        return returnOrderId;
    }

    public void setReturnOrderId(Long returnOrderId) {
        this.returnOrderId = returnOrderId;
    }

    public BigDecimal getNewCustomDisPrice() {
        return newCustomDisPrice;
    }

    public void setNewCustomDisPrice(BigDecimal newCustomDisPrice) {
        this.newCustomDisPrice = newCustomDisPrice;
    }

    public BigDecimal getPackDisPrice() {
        return packDisPrice;
    }

    public void setPackDisPrice(BigDecimal packDisPrice) {
        this.packDisPrice = packDisPrice;
    }

    public CommentStatus getCommentStatus() {
        return commentStatus;
    }

    public void setCommentStatus(CommentStatus commentStatus) {
        this.commentStatus = commentStatus;
    }

    public Integer getItemCount() {
        return itemCount;
    }

    public void setItemCount(Integer itemCount) {
        this.itemCount = itemCount;
    }

    private List<YgOrderDetail> orderDetail;

    public String getLogisticsCode() {
        return logisticsCode;
    }

    public void setLogisticsCode(String logisticsCode) {
        this.logisticsCode = logisticsCode;
    }

    public String getWdtOrderCode() {
        return wdtOrderCode;
    }

    public void setWdtOrderCode(String wdtOrderCode) {
        this.wdtOrderCode = wdtOrderCode;
    }

    public String getProductNames() {
        return productNames;
    }

    public void setProductNames(String productNames) {
        this.productNames = productNames;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public List<YgOrderDetail> getOrderDetail() {
        return orderDetail;
    }

    public void setOrderDetail(List<YgOrderDetail> orderDetail) {
        this.orderDetail = orderDetail;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Long supplierId) {
        this.supplierId = supplierId;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public BigDecimal getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public BigDecimal getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(BigDecimal productPrice) {
        this.productPrice = productPrice;
    }

    public BigDecimal getYouhuijuanPrice() {
        return youhuijuanPrice;
    }

    public void setYouhuijuanPrice(BigDecimal youhuijuanPrice) {
        this.youhuijuanPrice = youhuijuanPrice;
    }

    public BigDecimal getManjianPrice() {
        return manjianPrice;
    }

    public void setManjianPrice(BigDecimal manjianPrice) {
        this.manjianPrice = manjianPrice;
    }

    public BigDecimal getPaidPrice() {
        return paidPrice;
    }

    public void setPaidPrice(BigDecimal paidPrice) {
        this.paidPrice = paidPrice;
    }

    public BigDecimal getExpressPrice() {
        return expressPrice;
    }

    public void setExpressPrice(BigDecimal expressPrice) {
        this.expressPrice = expressPrice;
    }

    public OrderStatus getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(OrderStatus orderStatus) {
        this.orderStatus = orderStatus == null ? null : orderStatus;
    }

    public PayType getPayType() {
        return payType;
    }

    public void setPayType(PayType payType) {
        this.payType = payType == null ? null : payType;
    }

    public Date getPaidTime() {
        return paidTime;
    }

    public void setPaidTime(Date paidTime) {
        this.paidTime = paidTime;
    }

    public String getCancelReason() {
        return cancelReason;
    }

    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason == null ? null : cancelReason.trim();
    }

    public Date getCancelTime() {
        return cancelTime;
    }

    public void setCancelTime(Date cancelTime) {
        this.cancelTime = cancelTime;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    public String getExpressCompany() {
        return expressCompany;
    }

    public void setExpressCompany(String expressCompany) {
        this.expressCompany = expressCompany == null ? null : expressCompany.trim();
    }

    public String getExpressCode() {
        return expressCode;
    }

    public void setExpressCode(String expressCode) {
        this.expressCode = expressCode == null ? null : expressCode.trim();
    }

    public Date getConfirmReceiveTime() {
        return confirmReceiveTime;
    }

    public void setConfirmReceiveTime(Date confirmReceiveTime) {
        this.confirmReceiveTime = confirmReceiveTime;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver == null ? null : receiver.trim();
    }

    public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName == null ? null : cityName.trim();
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName == null ? null : areaName.trim();
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }

    public String getTelPhone() {
        return telPhone;
    }

    public void setTelPhone(String telPhone) {
        this.telPhone = telPhone == null ? null : telPhone.trim();
    }

    public String getPostCode() {
        return postCode;
    }

    public void setPostCode(String postCode) {
        this.postCode = postCode == null ? null : postCode.trim();
    }

    public String getSourceCode() {
        return sourceCode;
    }

    public void setSourceCode(String sourceCode) {
        this.sourceCode = sourceCode == null ? null : sourceCode.trim();
    }

    public String getUserRemark() {
        return userRemark;
    }

    public void setUserRemark(String userRemark) {
        this.userRemark = userRemark == null ? null : userRemark.trim();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public DataStatus getStatus() {
        return status;
    }

    public void setStatus(DataStatus status) {
        this.status = status == null ? null : status;
    }

    public Long getCouponDetailId() {
        return couponDetailId;
    }

    public void setCouponDetailId(Long couponDetailId) {
        this.couponDetailId = couponDetailId;
    }

    public AppType getAppType() {
        return appType;
    }

    public void setAppType(AppType appType) {
        this.appType = appType;
    }

    public String getFormId() {
        return formId;
    }

    public void setFormId(String formId) {
        this.formId = formId;
    }

    public OrderType getOrderType() {
        return orderType;
    }

    public void setOrderType(OrderType orderType) {
        this.orderType = orderType;
    }

    public Long getReleationId() {
        return releationId;
    }

    public void setReleationId(Long releationId) {
        this.releationId = releationId;
    }

    public String getPrepayId() {
        return prepayId;
    }

    public void setPrepayId(String prepayId) {
        this.prepayId = prepayId;
    }

    @Override
    public YgOrder clone() {
        YgOrder order = null;
        try {
            order = (YgOrder) super.clone(); // 浅复制
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return order;
    }

    public Boolean getNewPaidUser() {
        return newPaidUser;
    }

    public void setNewPaidUser(Boolean newPaidUser) {
        this.newPaidUser = newPaidUser;
    }

    @Override
    public String toString() {
        return "YgOrder [id=" + id + ", orderId=" + orderId + ", wdtOrderCode=" + wdtOrderCode + ", userId=" + userId + ", supplierId=" + supplierId
                + ", parentId=" + parentId + ", totalPrice=" + totalPrice + ", productPrice=" + productPrice + ", youhuijuanPrice=" + youhuijuanPrice
                + ", manjianPrice=" + manjianPrice + ", paidPrice=" + paidPrice + ", expressPrice=" + expressPrice + ", orderStatus=" + orderStatus
                + ", payType=" + payType + ", paidTime=" + paidTime + ", cancelReason=" + cancelReason + ", cancelTime=" + cancelTime + ", sendTime=" + sendTime
                + ", expressCompany=" + expressCompany + ", logisticsCode=" + logisticsCode + ", expressCode=" + expressCode + ", confirmReceiveTime="
                + confirmReceiveTime + ", receiver=" + receiver + ", provinceName=" + provinceName + ", cityName=" + cityName + ", areaName=" + areaName
                + ", address=" + address + ", telPhone=" + telPhone + ", postCode=" + postCode + ", sourceCode=" + sourceCode + ", couponDetailId="
                + couponDetailId + ", userRemark=" + userRemark + ", createTime=" + createTime + ", status=" + status + ", userName=" + userName
                + ", productNames=" + productNames + ", orderDetail=" + orderDetail + "]";
    }

}